<extend name="Public/base"/>
<block name="style">
    <style>
        .checkbox-inline+.checkbox-inline{margin-left:0;padding-left: 0;}
    </style>
</block>
<block name="body">

<div class="row">
<div class="col-md-12">
<div class="portlet box red">
<div class="portlet-title">
    <div class="caption"><i class="fa fa-reorder"></i>修改基础信息</div>
    <div class="tools">
        <a href="javascript:;" class="collapse"></a>
        <a href="javascript:;" class="remove"></a>
    </div>
</div>
<div class="portlet-body form">
    <form class="form-horizontal" action="{:U('')}" method="post">
        <div class="form-body">
            <div class="col-md-7">
                <div class="form-group">
                    <label class="control-label col-md-3">姓名</label>

                    <div class="col-md-5">
                        <input type="text" name="nickname" value="{$userinfo.nickname}" class="form-control"/>
                    </div>
                    <div class="col-md-4">
                        <label class="help-block">不可修改</label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-md-3">电话号码</label>

                    <div class="col-md-5">
                        <input type="text" class="form-control" value="{$userinfo.mobile_phone}" name="mobile_phone" placeholder="请输入11位手机号码"/>
                    </div>
                    <if condition="UID neq 1">

                    <div class="col-md-4">
                        <input type="button" class="btn blue" value="获取验证码"/>
                    </div>
                </div>

                    <div class="form-group">
                        <label class="control-label col-md-3">验证码</label>

                        <div class="col-md-5">
                            <input type="text" class="form-control" name="yzm" placeholder="请输入验证码"/>
                        </div>
                </if>

                    </div>



                <div class="form-group">
                    <label class="control-label col-md-3">性别</label>

                    <div class="col-md-5">
                        <if condition="$userinfo.sex eq 0">
                            <div class="radio-list">
                                <label class="radio-inline">
                                    <input type="radio" name="sex" value="0" checked>男
                                </label>
                                <label class="radio-inline">
                                    <input type="radio" name="sex" value="1">女
                                </label>
                            </div>
                            <else/>
                            <div class="radio-list">
                                <label class="radio-inline">
                                    <input type="radio" name="sex" value="0">男
                                </label>
                                <label class="radio-inline">
                                    <input type="radio" name="sex" value="1" checked>女
                                </label>
                            </div>
                        </if>

                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label col-md-3">身份证号码</label>

                    <div class="col-md-5">
                        <input type="text" class="form-control" value="{$userinfo.idcard}" name="idcard" placeholder="请输入身份证号码"/>
                    </div>
                    <div class="col-md-4">
                        <label class="help-block">不可修改</label>
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label col-md-3">执业号码</label>

                    <div class="col-md-5">
                        <input type="text" name="practice_number" value="{$userinfo.practice_number}" class="form-control" placeholder="请输入执业号码"/>
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label col-md-3">居住地址</label>

                    <div class="col-md-5">
                        <input type="text" name="residential_address" value="{$userinfo.residential_address}" class="form-control" placeholder="请输入现居住地"/>
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label col-md-3">任教科目</label>
                    <div class="col-md-8">
                        <div class="checkbox-list">
                            <volist name="s_list" id="vo">
                                <label class="checkbox-inline">
                                    <if condition="$vo.val eq 1">
                                        <input value="{$vo.sid}" name="subject_name[]" type="checkbox" checked>{$vo.subject_name}
                                        <else/>
                                        <input value="{$vo.sid}" name="subject_name[]" type="checkbox">{$vo.subject_name}
                                    </if>

                                </label>
                            </volist>
                        </div>
                    </div>
                </div>
            </div>

            <div class="col-md-5">
                <div class="form-group">
                    <label class="control-label col-md-4">头像照片</label>
                    <div class="col-md-8">
                        <div class="fileupload fileupload-new" data-provides="fileupload">
                            <div class="fileupload-new thumbnail" >
                                <img id="field_pic_head_img_url" style="width:150px;height: 100px;" src="{$userinfo.head_img_url}" alt="" />
                            </div>
                            <div class="fileupload-preview fileupload-exists thumbnail" style="max-width: 200px; max-height: 150px; line-height: 20px;"></div>
                            <div>
                                <input type="file"  class="default"  id="head_img_url"    />
                                <input type="hidden"  name="head_img_url"   value="{$userinfo.head_img_url}" />

                            </div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-md-4">身份证照片</label>
                    <div class="col-md-8">
                        <div class="fileupload fileupload-new" data-provides="fileupload">
                            <div class="fileupload-new thumbnail" >
                                <img style="width:150px;height: 100px;" id="field_pic_idcard_photo" src="{$userinfo.idcard_photo}" alt="" />
                            </div>
                            <div class="fileupload-preview fileupload-exists thumbnail" style="max-width: 200px; max-height: 150px; line-height: 20px;"></div>
                            <div>
                                <input type="file"  class="default"  id="idcard_photo"    />
                                <input type="hidden"  name="idcard_photo"   value="{$userinfo.idcard_photo}" />

                            </div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-md-4">执业证照片</label>
                    <div class="col-md-8">
                        <div class="fileupload fileupload-new" data-provides="fileupload">
                            <div class="fileupload-new thumbnail" >
                                <img id="field_pic_practice_photo" style="width:150px;height: 100px;" src="{$userinfo.practice_photo}" alt="" />
                            </div>
                            <div class="fileupload-preview fileupload-exists thumbnail" style="max-width: 200px; max-height: 150px; line-height: 20px;"></div>
                            <div>
                                <input type="file"  class="default"  id="practice_photo"    />
                                <input type="hidden"  name="practice_photo"   value="{$userinfo.practice_photo}" />

                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
        <div class="clearfix"></div>
        <input type="hidden" name="uid" value="{$userinfo.uid}"/>
        <div class="form-actions fluid">
            <div class="row">
                <div class="col-md-12">
                    <div class="col-md-offset-3 col-md-6">
                        <button type="submit" target-form="form-horizontal" class="ajax-post btn green">确定</button>
                        <button type="button" class="btn default">返回</button>
                    </div>
                </div>
            </div>

        </div>

    </form>
    <div class="clearfix"></div>
</div>
</div>
<!-- END PORTLET-->
</div>
</div>

</block>

<block name="script">
<!-- BEGIN PAGE LEVEL SCRIPTS -->
<script src="__STATIC__/scripts/app.js"></script>

<!-- END PAGE LEVEL SCRIPTS -->
 <script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js?t={:rand(0,9999)}"></script>
<script>

    var _file = []; _file['picture'] = [];
        _file['picture'].push("head_img_url");
        _file['picture'].push("idcard_photo");
        _file['picture'].push("practice_photo");
       jQuery(document).ready(function () {
// initiate layout and plugins
    App.init();

    _file['picture'].forEach(function(i){
        $("#"+i).uploadify({
            "height"          : 34,
            "swf"             : "__STATIC__/uploadify/uploadify.swf",
            "fileObjName"     : "download",
            "buttonText"      : "上传图片",
            "uploader"        : "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
            "width"           : 80,
            'removeTimeout'	  : 1,
            'fileTypeExts'	  : '*.jpg; *.png; *.gif;',
            "onUploadSuccess" : function(file, data){
                var data = $.parseJSON(data);
                var src = '';
                console.log(data);
                if(data.status){
                    $("input[name='"+i+"']").val(data.path);
                    src = data.url || '__ROOT__' + data.path
                    $("#field_pic_"+i).attr({"src":src}).parent().css({"width":'',"height":''});
                } else {
                    updateAlert(data.info);
                    setTimeout(function(){
                        $('#top-alert').find('button').click();
                        $(that).removeClass('disabled').prop('disabled',false);
                    },1500);
                }
            },
            'onFallback' : function() {
                alert('未检测到兼容版本的Flash.');
            }
        });
    })






})

</script>
</block>


